home *** CD-ROM | disk | FTP | other *** search
/ Menu Planner / Menu Planner (Ohio Distinctive Software).ISO / pc / mp.dir / 00145_Validations.ls < prev    next >
Encoding:
Text File  |  1995-11-07  |  950 b   |  39 lines

  1. on validatePDCScreen
  2.   global calcdata
  3.   set DDC to integer(field "calories")
  4.   if DDC < 800 then
  5.     setaProp(calcdata, #desired_calories, 800)
  6.     put 800 into field "calories"
  7.     lowhelp()
  8.     return 0
  9.   else
  10.     if DDC > 5000 then
  11.       put 5000 into field "calories"
  12.       setaProp(calcdata, #desired_calories, 5000)
  13.       highhelp()
  14.       return 0
  15.     else
  16.       return 1
  17.     end if
  18.   end if
  19.   set numMeals to integer(field "meals")
  20.   if numMeals < 2 then
  21.     put 2 into field "Meals"
  22.     alert("Please enter either 2 or 3 for the number of meals. The value you entered has been changed to 2.")
  23.   else
  24.     if numMeals > 3 then
  25.       put 3 into field "meals"
  26.       alert("Please enter either 2 or 3 for the number of meals. the value you entered has been changed to 3.")
  27.     end if
  28.   end if
  29. end
  30.  
  31. on PDCOK
  32.   set OK to 1
  33.   if (the frameLabel = "PDC") and not validatePDCScreen() then
  34.     set OK to 0
  35.     put "OK = " & OK
  36.   end if
  37.   return OK
  38. end
  39.